using UnityEngine;
using System.Collections;

public class MonsterDie : MonoBehaviour {

    public int timespan = 1;
	Public int TETA = 0;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

        float angle = Vector3.Angle(Vector3.up, transform.up);

        if (angle > 45.0f)
        {
            destroy();
        }
	}

    void OnCollisionEnter(Collision hit)
    {
        if (hit.transform.CompareTag ("Bullet"))
        {
            destroy();
        }
    }

    void destroy()
    {
        BroadcastMessage("changeStatus", 1);
        Destroy(gameObject, timespan);
    }
}
